- name: install datagrepper and required packages
  package: name={{ item }} state=present
  with_items:
  - datagrepper
  - python-psycopg2
  tags:
  - packages
  - datagrepper

- name: creating datagrepper config dir
  file: path=/etc/datagrepper state=directory owner=root mode=755
  tags:
  - config
  - datagrepper

- name: setting up datagrepper config from the template
  template: src=datagrepper.cfg dest=/etc/datagrepper/datagrepper.cfg owner=fedmsg group=fedmsg mode=640
  tags:
  - config
  - datagrepper

- name: setting up credential from the template
  template: src=datagrepper-fedmsg.py dest=/etc/fedmsg.d/datagrepper.py owner=fedmsg group=fedmsg mode=640
  notify:
  - reload httpd
  tags:
  - config
  - datagrepper

- name: remove bum default config files
  file: dest="/etc/fedmsg.d/{{item}}" state=absent
  with_items:
  - datanommer.py
  - datanommer.pyc
  - datanommer.pyo
  tags:
  - config
  - datagrepper

- name: installing memcached package for /topics
  package: name=python-memcached state=present
  tags:
  - packages
  - datagrepper

- name: setting up httpd config
  template: src=datagrepper-app.conf dest=/etc/httpd/conf.d/datagrepper.conf owner=root group=root
  notify:
  - reload httpd
  tags:
  - config
  - datagrepper

- name: ensure selinux lets httpd talk to the database
  seboolean: name=httpd_can_network_connect_db persistent=yes state=yes
  tags:
  - datagrepper

- name: ensure selinux lets httpd talk to the memcache
  seboolean: name=httpd_can_network_memcache persistent=yes state=yes
  tags:
  - datagrepper

# selinux policy has been intentionally omitted since that is obtained from fedmsg/base

